#include <QApplication>
#include "Functionality/applycertificatefactory.h"
#include "Functionality/applycertificatefunctionality.h"
#include "Functionality/functionalityFactory.h"
#include "loginWidget/mainloginwidget.h"
// #include "openssl-applink/applink.c"
#include "MainMettingWidget/mettingwidget.h"
#include "MainMettingWidget/screen.h"
#include "src/loginWidget/logincode.h"
#include "utils/keymanager.h"
#include "utils/signalcenter.h"
/**
 * @brief qMain
 * @param argc
 * @param argv
 * @return 
 * 
 * 出现了 OPENSSL_Uplink(00007FFF71EA4600,08): no OPENSSL_Applink 这个错误，就是因为File * 和openssl的问题
 * 改用BIO来保存来进行读写操作就行
 */

int main(int argc, char *argv[])
{
    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
    QApplication a(argc, argv);
    ERR_load_crypto_strings(); // 加载错误字符串，便于调试
    //我觉得当系统一启动时就可以看看是否存在证书和要申请证书吗？
    //只有是公钥证书无效、私钥已经无效了就会重新生成公私钥并申请公钥证书
    Screen::init();
    // mainLoginWidget mainLogin;
    // mainLogin.show();

    // QObject::connect(&SIGNALCENTER, &SignalCenter::loginSuccessed, [&]() {
    //     qDebug() << "登录成功";
    //     mainLogin.close();
    // });

    MettingWidget metting;
    metting.show();

    // FrameLessWindow fw;
    // fw.show();
    //设置app的图标
    QIcon icon(":/resources/titleIcon.png");
    a.setWindowIcon(icon);
    return a.exec();
}
